cmake_minimum_required (VERSION 3.16.0)

# projectname is the same as the main-executable
project(iosvr)

# set(CMAKE_BUILD_TYPE "Debug")
# SET(CMAKE_BUILD_TYPE "Release")

# 添加编译选项
add_definitions('-std=c++17')

if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_definitions('-g')
add_definitions('-Wall')
add_definitions('-rdynamic')
add_definitions('-ldl')
endif()

# if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
# add_definitions('-fsanitize=address')
# add_definitions('-fno-omit-frame-pointer')
# add_definitions('-g')
# add_definitions('-O2')
# endif()

# -D定义宏变量
# add_definitions('-D_FILE_OFFSET_BITS=64')
# add_definitions('-DFUSE_USE_VERSION=26')

# INCLUDE_DIRECTORIES( include)

# SET(${PROJECT_NAME} ${DIR_SRCS})
# AUX_SOURCE_DIRECTORY(src DIR_SRCS)

# 查找当前目录中的所有源文件，并将结果列表存放在变量DIR_SRCS中
include_directories(MemPool Buffer .)
aux_source_directory(MemPool DIR_SRCS)
aux_source_directory(Buffer DIR_SRCS)
aux_source_directory(. DIR_SRCS)

# 指定可执行文件名称，PROJECT_NAME是前面定义的project名称
add_executable(${PROJECT_NAME} ${DIR_SRCS})

# 添加依赖的链接库
# target_link_libraries(${PROJECT_NAME} pthread dl)

# if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
# target_link_libraries(${PROJECT_NAME} asan pthread)
# else()
target_link_libraries(${PROJECT_NAME} pthread)
# endif()
